Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

Recover the panic caused by close sendCh #50

Merged
merged 1 commit into from
Mar 28, 2020
Merged

Conversation

arugal
Copy link
Member

@arugal arugal commented Mar 24, 2020

@arugal arugal added the enhancement New feature or request label Mar 24, 2020
@arugal arugal added this to the 0.4.0 milestone Mar 24, 2020
@arugal arugal linked an issue Mar 24, 2020 that may be closed by this pull request
@@ -264,6 +264,12 @@ func (r *gRPCReporter) Send(spans []go2sky.ReportedSpan) {
r.logger.Printf("marshal segment object err %v", err)
return
}
defer func() {
// recover the panic caused by close sendCh
if err := recover(); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this recover do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it in TestGRPCReporter_Close

@wu-sheng wu-sheng merged commit aa3669f into SkyAPM:master Mar 28, 2020
@arugal arugal deleted the patch-2 branch March 28, 2020 13:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panic: send on closed channel
2 participants